package com.link.base.base.forum.dao.mybatis.mapper;

import com.link.base.base.forum.model.ForumReplay;
import com.link.base.base.forum.model.Forum;
import com.link.base.base.forum.model.People;
import com.link.core.basic.dao.mapper.BasicMapper;

import java.util.List;

public interface ForumMapper extends BasicMapper<Forum> {

    /**
     * 查询帖子列表
     *
     * @param record
     * @return
     * @throws Exception
     */
    List<Forum> queryForumListPage(Forum record) throws Exception;

    /**
     * 新增主题帖子
     *
     * @param record
     * @throws Exception
     */
    void forumInsert(Forum record) throws Exception;

    /**
     * 更新主题帖子
     *
     * @param record
     * @throws Exception
     */
    void forumUpdate(Forum record) throws Exception;

    /**
     * 查询主题帖的回复内容
     *
     * @param record
     * @return
     * @throws Exception
     */
    List<ForumReplay> queryForumReplayPage(ForumReplay record) throws Exception;

    /**
     * 新增主题回复帖子
     *
     * @param record
     * @throws Exception
     */
    void forumReplayInsert(ForumReplay record) throws Exception;


    /**
     * 修改论坛主题头的主题回复数量
     *
     * @param record
     * @throws Exception
     */
    void forumReplyNumUpdate(Forum record) throws Exception;

    /**
     * 根据主题id删除主题所有回复
     *
     * @param record
     * @throws Exception
     */
    void useNoteIdToForumReplayDelete(Forum record) throws Exception;

    /**
     * 根据主题id删除主题
     *
     * @param record
     * @throws Exception
     */
    void useIdToForumDelete(Forum record) throws Exception;


    /**
     * 查询主题可选参与人
     *
     * @param record
     * @return
     * @throws Exception
     */
    List<People> queryPeoplePage(People record) throws Exception;

    /**
     * 查询主题已选的参与人
     *
     * @param record
     * @return
     * @throws Exception
     */
    List<People> queryPeopleOfForumByPage(People record) throws Exception;


    /**
     * 通过参与人id以及主题id删除主题已选的参与人
     *
     * @param record
     * @throws Exception
     */
    void forumPeopleDelete(People record) throws Exception;

    /**
     * 插入主题联系人
     *
     * @param record
     * @throws Exception
     */
    void forumPeopleInsert(People record) throws Exception;

    /**
     * 查询各类型帖子数量
     *
     * @author lizt
     * 2017年4月26日
     */
    List<Forum> queryForumTypeNum(Forum record) throws Exception;

    /**
     * 删除论坛回复
     *
     * @param record
     * @throws Exception
     */
    void delForumReplyById(ForumReplay record) throws Exception;

    /**
     * 修改论坛回复数量
     *
     * @param record
     * @throws Exception
     */
    void forumReplyMinusUpdate(ForumReplay record) throws Exception;


    /**
     * 评论查询
     *
     * @param record
     * @throws Exception
     */
    List<ForumReplay> queryForumReplayList(ForumReplay record) throws Exception;

    /**
     * 评论总数
     *
     * @param record
     * @throws Exception
     */
    int queryForumReplayListCount(ForumReplay record) throws Exception;

    /**
     * 更新帖子上的回复数
     *
     * @param record
     * @throws Exception
     */
    void forumNoteReplyNumUpdate(ForumReplay record);

    int judgeForumExistById(String id) throws Exception;

    /**
     * 修改浏览量、阅读人数、收藏数、点赞数
     * 
     * @author ouyangzhenqiang
     * @date 2019/03/06 22:11
     * @param forum 帖子对象
     */
    void updateNum(Forum forum) throws Exception;
}
